<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class crm_deal extends Model
{
    // 成交单表模型
    protected $table = 'crm_deal';
    public $timestamps = false;
    protected $fillable = ['deal_num','deal_yshoukuan','deal_ydakuan','deal_lvke','deal_leibie','deal_ftdate','deal_dealdate','deal_jiesuanstatue','deal_dkfs','deal_dealdate','deal_jiesuanstatue','deal_orderid','deal_customer_id','deal_yglirun','deal_lirun','deal_yuangong','deal_hetongtype','deal_hetong','deal_userid','deal_sshoukuan','deal_sdakuan','deal_jsxiaoxi'];
    // 关联游客表模型
    
    public function crm_order()
    {
    	return $this->hasOne('App\crm_order','id', 'deal_orderid');
    }
    // 关联供应商模型
    public function crm_suppliers()
    {
    	return $this->belongsToMany('App\crm_supplier');
    }
    // 关联客户表模型
    // public function crm_customer()
    // {
    //     return $this->belongsTo('App\crm_customer','deal_customer_id','id');
    // }王
    public function crm_users()
    {
        return $this->belongsTo('App\crm_users','deal_userid','id');
    }
    
}
